<template>
  <div class="">
    <h1>商品详情页</h1>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, index) in imgs" :key="index">
        <img :src="item.src" alt="" />
      </van-swipe-item>
    </van-swipe>
    <van-button @click="gotodesc">图文详情</van-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      id: this.$route.query.id,
      imgs: [],
    };
  },
  mounted() {
    this.$axios.get("/api/getthumimages/" + this.id).then((res) => {
      console.log(res);
      this.imgs = res.data.message;
    });
  },
  methods: {
    gotodesc() {
      this.$router.push({ path: "/describe", query: { id: this.id } });
    },
  },
  components: {},
};
</script>

<style lang="scss">
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
</style>
